import {RouteConfig} from "@/types/router"

const filterAsyncRoute = (asyncRoute: RouteConfig[], routes: string[]) => {
    return asyncRoute.filter(route => {
        if (routes.includes(route.meta?.permission!)) {
            if (route.children && route.children.length > 0) {
                route.children = filterAsyncRoute(route.children, routes)
            }
            return true
        }
        return false
    })
}

export {filterAsyncRoute}
